//
//  YDYCommentCell.m
//  DYSisterAPP
//
//  Created by 杨德勇 on 2016/8/9.
//  Copyright © 2016年 杨德勇. All rights reserved.
//

#import "YDYCommentCell.h"
#import "YDYComment.h"
#import "YDYUser.h"
@interface YDYCommentCell()
@property (weak, nonatomic) IBOutlet UIImageView *profileImageView;
@property (weak, nonatomic) IBOutlet UIImageView *sexView;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UILabel *likecountLabel;
@property (weak, nonatomic) IBOutlet UILabel *usernameLabel;

@property (weak, nonatomic) IBOutlet UIButton *voiceBtn;

@end

@implementation YDYCommentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"mainCellBackground"]];
}

-(void)setComment:(YDYComment *)comment{
    _comment = comment;
    
    self.usernameLabel.text = comment.user.username;
    self.contentLabel.text = comment.content;
    self.likecountLabel.text = [NSString stringWithFormat:@"%zd",comment.like_count];
    [self.profileImageView ydy_setCircleHeader:comment.user.profile_image PlaceHolderImage:[UIImage imageNamed:@"defaultUserIcon"]];
    
    NSString *sexImageName = [comment.user.sex isEqualToString:@"m"]?@"Profile_manIcon":@"Profile_womanIcon";
    self.sexView.image = [UIImage imageNamed:sexImageName];
    
    if (comment.voiceuri.length) {
        self.voiceBtn.hidden = NO;
        [self.voiceBtn setTitle:[NSString stringWithFormat:@"%zd''",comment.voicetime] forState:UIControlStateNormal];
    }else{
        self.voiceBtn.hidden = YES;
    }
}

@end
